CSharpTest.Net
Merge(IEnumerable<T>[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > OrderedEnumeration<T> Class > Merge Method : Merge(IEnumerable<T>[]) Method

enums

Glossary Item Box

Merges n-number of ordered enumerations based on the default comparer of T.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function Merge( _
   ByVal ParamArray enums() As IEnumerable(Of T) _
) As IEnumerable(Of T)
C# 
public static IEnumerable<T> Merge( 
   params IEnumerable<T>[] enums
)

Parameters

enums

Example

Library/Library.Test/TestOrderedEnumeration.cs

C#Copy Code
char[] x = "aeiou".ToCharArray();
char[] y = "bcdfg".ToCharArray();
char[] z = "ez".ToCharArray();

var order = OrderedEnumeration<char>.Merge(x, y, z);
Assert.AreEqual("abcdeefgiouz", new string(new List<char>(order).ToArray()));

order = OrderedEnumeration<char>.Merge(Comparer<char>.Default, DuplicateHandling.LastValueWins, x, y, z);
Assert.AreEqual("abcdefgiouz", new string(new List<char>(order).ToArray()));

order = OrderedEnumeration<char>.Merge(Comparer<char>.Default, x, y);
order = OrderedEnumeration<char>.WithDuplicateHandling(order, Comparer<char>.Default,
                                                       DuplicateHandling.FirstValueWins);
Assert.AreEqual("abcdefgiou", new string(new List<char>(order).ToArray()));
VB.NETCopy Code
Dim x As Char() = "aeiou".ToCharArray()
Dim y As Char() = "bcdfg".ToCharArray()
Dim z As Char() = "ez".ToCharArray()

Dim order As var = OrderedEnumeration(Of Char).Merge(x, y, z)
Assert.AreEqual("abcdeefgiouz", New String(New List(Of Char)(order).ToArray()))

order = OrderedEnumeration(Of Char).Merge(Comparer(Of Char).[Default], DuplicateHandling.LastValueWins, x, y, z)
Assert.AreEqual("abcdefgiouz", New String(New List(Of Char)(order).ToArray()))

order = OrderedEnumeration(Of Char).Merge(Comparer(Of Char).[Default], x, y)
order = OrderedEnumeration(Of Char).WithDuplicateHandling(order, Comparer(Of Char).[Default], DuplicateHandling.FirstValueWins)
Assert.AreEqual("abcdefgiou", New String(New List(Of Char)(order).ToArray()))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys